package project;

import java.util.ArrayList;

public class SimulationStatistics {
	
	private int currTime, waiting, working, lunch, meeting;

	private final ArrayList<Employee> employees;

	public class SimulationTime extends Thread{

		private final int maxMinutes;

		/**
		 * Time object that will interact with Statistics.
		 * */
		public SimulationTime(int maxMinutes) {
			this.maxMinutes = maxMinutes;
		}
		
		//run method
		public void run(){
			currTime = 0;
			while(currTime != maxMinutes){
				
				currTime++;
				try {
					Thread.sleep(10);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
	}
	
	public SimulationStatistics(
			ArrayList<Employee> employees) {
		this.employees = employees;
	}

	// get
	public synchronized void put(int waiting, int working, int lunch, int meeting){
		this.waiting += waiting;
		this.working += working;
		this.lunch += lunch;
		this.meeting += meeting;
	}
	
	// put
	public int getTime(){
		return currTime;
	}
	
	public String getFormattedTime(){
		int hourMark;
		int minuteMark;
		String returnStr = "";
		minuteMark = currTime%60;
		hourMark = currTime/60+8; 
		
		if (hourMark > 12)
		{
			hourMark = hourMark - 12;
		}
		
		if(minuteMark < 10){
			//System.out.printf("currTime = %d:%d0\n", hourMark, minuteMark);
			returnStr += hourMark +":0" + minuteMark;
			return returnStr;
		}
		//System.out.printf("currTime = %d:%d\n", hourMark, minuteMark);
		
		returnStr += hourMark +":" + minuteMark;
		return returnStr;
		
	}
}	
